﻿function category(name, items) {
    var self = this;
    
    self.name = name;
    self.subscriptions = ko.observableArray([]);
    $.each(items, function(index, item) {
        self.subscriptions.push(new subscription(item.Url, item.Name, item.UnreadCount));
    });
    
    self.removeItem = function (item) {
        $.ajax({
            url: '/home/delete',
            type: 'POST',
            data: {
                subName: item.name
            },
            success: function () {
                self.subscriptions.remove(item);
            }
        });
    };
}
